import store from "@/store/index";
// 此文件用于配置项和相关参数设置

//详情展示页
//基本信息
//基础信息模块
const detailInfo = [
  {
    label: "计划名称",
    name: "planName",
    value: ""
  },
  {
    label: "计划周期类别",
    name: "planPeriodType",
    value: ""
  },
  {
    label: "最新任务时间",
    name: "recentStartTime",
    value: ""
  },
  {
    label: "计划开始时间",
    name: "dailyStartTime",
    value: ""
  },
  {
    label: "计划周期",
    name: "dailyPeriod",
    value: ""
  },
  {
    label: "跳过周期",
    name: "dailySkipDays",
    value: ""
  },
  {
    label: "计划时间",
    name: "recentStartTime",
    value: ""
  },
  {
    label: "创建人",
    name: "createdBy",
    value: ""
  },
  {
    label: "创建时间",
    name: "createdTime",
    value: ""
  },
  {
    label: "最后更新",
    name: "updateTime",
    value: ""
  }
];

const detailShowInfo = { title: "基础信息", content: detailInfo };
const checkDeviceShowInfo = {
  title: "保养设备",
  content: "",
  showPage: false,
  tableColumns: [
    { type: "index", label: "序号", width: 140 },
    { prop: "deviceName", label: "设备名称", minWidth: 180 },

    {
      prop: "assetNumber",
      label: "设备编号",
      width: 100
      // render: (row) => {
      //   const { deviceInfo } = row;
      //   return deviceInfo.name ? deviceInfo.name :"";
      // },
    },
    {
      prop: "useOrganName",
      label: "使用部门",
      width: 100
    },
    { prop: "partPicList", label: "保养部位简图", minWidth: 180 }
  ],
  tableData: []
};
const checkOperateShowInfo = {
  title: "保养员",
  content: "",
  showPage: false,
  tableColumns: [
    { type: "index", label: "序号", width: 140 },
    { prop: "empno", label: "员工编号", minWidth: 180 },

    {
      prop: "membName",
      label: "姓名",
      width: 100
      // render: (row) => {
      //   const { deviceInfo } = row;
      //   return deviceInfo.name ? deviceInfo.name :"";
      // },
    },
    {
      prop: "phone",
      label: "手机号",
      width: 100
    },
    { prop: "organName", label: "部门", minWidth: 180 }
  ],
  tableData: []
};
const checkItemsShowInfo = {
  title: "保养项",
  showPage: false,
  content: "",
  tableColumns: [
    { type: "index", label: "序号", width: 140 },
    { prop: "part", label: "保养部位", minWidth: 180 },

    {
      prop: "content",
      label: "保养内容",
      width: 100
      // render: (row) => {
      //   const { deviceInfo } = row;
      //   return deviceInfo.name ? deviceInfo.name :"";
      // },
    },
    {
      prop: "standard",
      label: "保养基准",
      width: 100
    },
    { prop: "method", label: "保养方法", minWidth: 180 }
    // { prop: "upPicFlag", label: "上传图片", minWidth: 180 },
    //{ prop: "upVideoFlag", label: "上传视频", minWidth: 180 },
  ],
  tableData: []
};
// 基础信息表单配置
const formData = {
  title: "基础信息",
  formModel: {
    deviceId: "",
    planName: "",
    planPeriodType: "",
    dailyStartTime: "",
    dailyPeriod: "",
    dailySkipDays: [],
    planPeriodTotalValue: "",
    dailyPeriodType: "", //这个字段单独处理
    preserveType: ""
  },
  formComponent: [
    {
      type: "input",
      label: "计划名称",
      model: "planName",
      keyUpEnter: "handleFilter",
      rules: [{ required: true, message: "请输入计划名称", trigger: "blur" }]
    },
    {
      type: "select",
      label: "保养类型",
      model: "preserveType", //0例行保养，1故障保养，2定期保养，3停放保养，4走合期保养，5换季保养，6工作转移保养
      option: [
        { label: "例行保养", value: "0" },
        { label: "故障保养", value: "1" },
        { label: "定期保养", value: "2" },
        { label: "停放保养", value: "3" },
        { label: "走合期保养", value: "4" },
        { label: "换季保养", value: "5" },
        { label: "工作转移保养", value: "6" }
      ],
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    },
    {
      type: "select",
      label: "计划周期类别",
      model: "planPeriodType",
      option: [{ label: "定期", value: "1" }, { label: "日常", value: "0" }],
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    },
    {
      span: 5,
      type: "datePicker",
      label: "计划开始时间",
      model: "dailyStartTime",
      rules: [
        { required: true, message: "请输入计划开始时间", trigger: "blur" }
      ]
    },
    {
      span: 8,
      type: "selectRadio",
      label: "周期",
      model: "dailyPeriod",
      defaultValue: "day",
      unit: "dailyPeriodType",
      option: [
        { label: "天", value: "0" },
        { label: "周", value: "1" },
        { label: "月", value: "2" }
      ],
      rules: [{ required: true, message: "请输入计划周期", trigger: "blur" }]
    },
    {
      span: 11,
      type: "selectCheck",
      label: "跳过日期",
      model: "dailySkipDays",
      option: [
        { value: "1", label: "周一" },
        { value: "2", label: "周二" },
        { value: "3", label: "周三" },
        { value: "4", label: "周四" },
        { value: "5", label: "周五" }
      ],
      rules: [{ required: true, message: "请输入计划周期", trigger: "blur" }]
    }
  ],
  formComponent1: [
    {
      type: "input",
      label: "计划名称",
      model: "planName",
      keyUpEnter: "handleFilter",
      rules: [{ required: true, message: "请输入计划名称", trigger: "blur" }]
    },
    {
      type: "select",
      label: "保养类型",
      model: "preserveType", //0例行保养，1故障保养，2定期保养，3停放保养，4走合期保养，5换季保养，6工作转移保养
      option: [
        { label: "例行保养", value: "0" },
        { label: "故障保养", value: "1" },
        { label: "定期保养", value: "2" },
        { label: "停放保养", value: "3" },
        { label: "走合期保养", value: "4" },
        { label: "换季保养", value: "5" },
        { label: "工作转移保养", value: "6" }
      ],
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    },
    {
      // span: 18,
      type: "select",
      label: "计划周期类别",
      model: "planPeriodType",
      option: [{ label: "定期", value: "1" }, { label: "日常", value: "0" }],
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    },

    {
      span: 18,
      type: "dateRangepicker",
      label: "计划开始时间",
      model: "regularTime",
      option: [1, 2, 3],
      rules: [
        { required: true, message: "请输入计划开始时间", trigger: "blur" }
      ]
    }
  ]
};
// 档案信息
const operateFormInfo = {
  title: "保养员",
  formModel: {
    fileTitle: ""
  },
  formComponent: [
    {
      type: "select",
      label: "保养员类别",
      model: "membType",
      option: [
        { label: "指定人员", value: "0" },
        { label: "指定部门", value: "1" }
      ],
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    },
    {
      type: "select",
      label: "选择保养员",
      model: "membId",
      option: store.state.app.allUser.map(e => {
        //  return { value: e.value + "," + e.label, label: e.label };
        return { value: e.value + "", label: e.label };
      }),
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    }
  ],
  formComponent1: [
    {
      type: "select",
      label: "保养员类别",
      model: "membType",
      option: [
        { label: "指定人员", value: "0" },
        { label: "指定部门", value: "1" }
      ],
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    },
    {
      type: "cascader",
      label: "选择指定部门",
      model: "membId",
      option: store.state.app.allCode.department,
      rules: [{ required: true, message: "请输入设备名称", trigger: "blur" }]
    }
  ]
};
//整理后的表单配置
const deviceForm0 = [
  {
    formName: "计划基础信息",
    formRef: "table1", //表单ref
    formModel: formData.formModel, //表单model
    formComponent: formData.formComponent,
    formName: formData.title //表单标题
  }
];
const deviceForm1 = [
  {
    formName: "计划基础信息",
    formRef: "table1", //表单ref
    formModel: formData.formModel, //表单model
    formComponent: formData.formComponent1,
    formName: formData.title //表单标题
  }
];
const operateForm0 = [
  {
    formName: "保养员",
    formRef: "table2", //表单ref
    formModel: operateFormInfo.formModel, //表单model
    formComponent: operateFormInfo.formComponent,
    formName: operateFormInfo.title //表单标题
  }
];

const operateForm1 = [
  {
    formName: "保养员",
    formRef: "table2", //表单ref
    formModel: operateFormInfo.formModel, //表单model
    formComponent: operateFormInfo.formComponent1,
    formName: operateFormInfo.title //表单标题
  }
];

const data = {
  basicForm0: deviceForm0,
  basicForm1: deviceForm1,
  operateForm0: operateForm0,
  operateForm1: operateForm1,
  //----------表单显示相关---------//
  //计划基本信息
  detailShowInfo: detailShowInfo,
  //保养设备
  checkDeviceShowInfo: checkDeviceShowInfo,
  //保养员
  checkOperateShowInfo: checkOperateShowInfo,
  //保养项
  checkItemsShowInfo: checkItemsShowInfo
};
export default data;
